package com.example.demothree.service.imp;

import com.example.demothree.bean.*;
import com.example.demothree.dao.*;
import com.example.demothree.service.QueService;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

@Service
public class QueServiceImp implements QueService {
    @Resource
    private GoodsDao goodsDao;
    @Resource
    private SuppliersDao suppliersDao;
    @Resource
    private CustomerDao customerDao;
    @Resource
    private SaleItemDao saleItemDao;
    //naem查询商品
    @Override
    public Goods findByspName(String name) {
        return goodsDao.findGoodsByName(name);
    }
    //name查询供应商
    @Override
    public Suppliers findgysByName(String name) {
        return suppliersDao.findSuppliersByName(name);
    }
    //name查询客户
    @Override
    public Customer findkhByName(String name) {
        return customerDao.findCustomerByName(name);
    }
    //销售统计
    @Override
    public Page<SaleItem> quexstj(Integer pageNum, Integer pageSize) {
        Pageable pageable = PageRequest.of(pageNum,pageSize);
        Page<SaleItem> page ;
        page = saleItemDao.findAll(pageable);
        return page;
    }
    //name查询销售
    @Override
    public SaleItem findxsByName(String name) {
        return saleItemDao.findByName(name);
    }
}
